<template>
  <div class="flex-main">
    <div class="flex-body">
      <detail-slider></detail-slider>

      <div class="m-proTitle">
        <p>{{detail.ProjectName}}</p>
        <div>
          <b>兑换积分：{{detail.Integral}}</b>
          <p>已兑换：{{detail.ProjectSales}}</p>
        </div>
      </div>

      <div class="m-detail">
        <p class="m-title mb">商品详情</p>
        <div v-html="detail.project_content"></div>
        <!-- <img src="@/assets/images/p_02.jpg" alt> -->
      </div>
    </div>
    <div class="flex-bottom">
      <div class="m-detail-bottom">
        <div class="m-buy" @click="surebtn">确定兑换</div>
      </div>
    </div>
  </div>
</template>
<script>
import { integralProjectsDetail, integralApply } from "@/api/mine";
export default {
  name: "",
  data() {
    return {
      showSpec: false,
      num: 1,
      ProjectId:'',
      sta:'',    
      detail:'',            //积分详情
    };
  },
  components: {
    detailSlider: () => import("@/model/projectDetail/detailSlider"),
    evaluetionItem: () => import("@/model/evaluetion/evaluetionItem")
  },
  methods: {
    //   积分商品详情
    getIntegralDetail() {
        let that = this;
        let param = {
            CustomerId: that.$utils.uid,
            ProjectId: that.ProjectId,
            sta: that.sta,
        }
        integralProjectsDetail(param).then(result=>{
            that.detail = result.list;
        })
    },
    // 确定兑换
    surebtn() {
        let that = this;
        that.$messagebox
            .confirm("确认兑换")
            .then(result => {
            console.log("确认兑换");
            let param = {
                CustomerId: that.$utils.uid,
                ProjectId: that.ProjectId,
                sta: that.sta,
            }
            integralApply(param).then(result=>{
                that.$toast('兑换成功');
            })
            })
            .catch(err => {});
    }
  },
  mounted() {
      this.ProjectId = this.$route.query.ProjectId;
      this.sta = this.$route.query.sta;
      this.getIntegralDetail();
  }
};
</script>
<style lang="less" scoped src="@/less/projectDetail/projectDetail.less"></style>
<style scoped>
.m-detail-html>>>img{
    width: 100%;
}
</style>
